// 打开遮罩等待
function showLoading() {
    return layer.load( 2, { shade: [0.5, '#f5f5f5'] });
}

// 关闭遮罩
function closeLoading(index) {
    layer.close(index);
}

// 弹出警告
function showWarning(msg) {
    layer.alert(msg, {
        title: [
            '警告',
            'background-color:#337ab7; color:#f5f5f5;font-size:16px;'
        ],icon: 0,move:false
    });
}

// 提示消息
function showTips(msg,obj) {
    layer.tips(msg, obj);
}

// 封装通用请求接口-post
function callAjaxByPost(url, param, fnSuccess, fnError) {
    $.ajax({
        type: 'post',
        contentType: "application/json;charset=utf-8",
        url: url,
        data: JSON.stringify(param),
        success: function(data, status) {
            fnSuccess(data);
        },
        complete: function(xhr, xs) {

        },
        error: function(xmlHttpRequest, textStatus, errorThrown) {
            fnError();
        }
    });
}

// 封装通用请求接口-get
function callAjaxByGet(url, fnSuccess, fnError) {
    $.ajax({
        type: 'get',
        contentType: "application/json;charset=utf-8",
        url: url,
        success: function(data, status) {
            fnSuccess(data);
        },
        complete: function(xhr, xs) {

        },
        error: function(xmlHttpRequest, textStatus, errorThrown) {
            fnError();
        }
    });
}